#ifndef CARGOPOOL_H
#define CARGOPOOL_H

#include <QObject>
#include "macrohelper.h"
#include <mutex>
#include <memory>
#include "cargo.h"

// 获取池
class CargoPool : public QObject
{
    Q_OBJECT
    SINGLETON(CargoPool)
    QML_READONLY_PROPERTY(QStringList, cargoList, CargoList)
public:
    explicit CargoPool(QObject *parent = nullptr);
    void fillCargo();
    std::shared_ptr<Cargo> popCargo();
    bool hasCargo();

signals:

public slots:
private:
    QStringList getNewCargoList();
    std::vector<std::shared_ptr<Cargo>> m_cargo_que;
    std::mutex m_que_mtx;
};

#endif // CARGOPOOL_H
